package cn.gwm.flink.streaming.beans.trip;


import cn.hutool.setting.Setting;

import java.math.BigDecimal;
import java.util.Properties;


/**
 * Flink Application Setting
 *
 * @author byh
 */
public class ApplicationSetting {
    private static final Setting CONNECT_SETTING = new Setting("connect.setting");
    private static final String KAFKA_CONSUMER_TOPIC_LIST = "KAFKA_CONSUMER_TOPIC_LIST";
    private static final String KAFKA_PRODUCER_TOPIC_LIST = "KAFKA_PRODUCER_TOPIC_LIST";
    private static final String KAFKA_CONSUMER_TOPIC_EV = "KAFKA_CONSUMER_TOPIC_EV";
    private static final String KAFKA_CONSUMER_TOPIC_PHEV = "KAFKA_CONSUMER_TOPIC_PHEV";
    private static final String KAFKA_PRODUCER_TOPIC = "KAFKA_PRODUCER_TOPIC";
    /**
     * 稳态时长
     */
    private static final String STEADY_STATE_DURATION = "STEADY_STATE_DURATION";
    /**
     * 车速阈值
     */
    private static final String CURRENT_VELOCITY_THRESHOLD = "CURRENT_VELOCITY_THRESHOLD";
    /**
     * 行程超时持续时间（单位：s）
     */
    private static final String TRIP_TIMEOUT_DURATION = "TRIP_TIMEOUT_DURATION";

    private static final String TRIP_PAUSE_DURATION = "TRIP_PAUSE_DURATION";
    private static final String HBASE_ZOOKEEPER_QUORUM = "HBASE_ZOOKEEPER_QUORUM";
    private static final String HBASE_ZOOKEEPER_PROPERTY_CLIENTPORT = "HBASE_ZOOKEEPER_PROPERTY_CLIENTPORT";
    private static final String CHARGING_STATION_TYPE_URL = "CHARGING_STATION_TYPE_URL";


    public static String getKafkaConsumerTopicList() {
        return CONNECT_SETTING.getStr(KAFKA_CONSUMER_TOPIC_LIST);
    }

    public static String getKafkaProducerTopicList() {
        return CONNECT_SETTING.getStr(KAFKA_PRODUCER_TOPIC_LIST);
    }

    public static String getKafkaConsumerTopicEv() {
        return CONNECT_SETTING.getStr(KAFKA_CONSUMER_TOPIC_EV);
    }

    public static String getKafkaConsumerTopicPhev() {
        return CONNECT_SETTING.getStr(KAFKA_CONSUMER_TOPIC_PHEV);
    }

    public static String getKafkaProducerTopic() {
        return CONNECT_SETTING.getStr(KAFKA_PRODUCER_TOPIC);
    }

    public static long getSteadyStateDuration() {
        return CONNECT_SETTING.getLong(STEADY_STATE_DURATION);
    }

    public static long getTripTimeoutDuration() {
        return CONNECT_SETTING.getLong(TRIP_TIMEOUT_DURATION);
    }
    public static long getTripPauseDuration() {
        return CONNECT_SETTING.getLong(TRIP_PAUSE_DURATION);
    }

    public static double getCurrentVelocityThreshold() {
        return CONNECT_SETTING.getDouble(CURRENT_VELOCITY_THRESHOLD);
    }

    public static String getHbaseZookeeperQuorum() {
        return CONNECT_SETTING.getStr(HBASE_ZOOKEEPER_QUORUM);
    }

    public static String getHbaseZookeeperPropertyClientport() {
        return CONNECT_SETTING.getStr(HBASE_ZOOKEEPER_PROPERTY_CLIENTPORT);
    }


    public static Properties getKafkaConsumerProp() {
        Properties prop = new Properties();
        prop.put("bootstrap.servers", getKafkaConsumerTopicList());
        return prop;
    }
    public static String getCHARGING_STATION_TYPE_URL() {
        return CONNECT_SETTING.getStr(CHARGING_STATION_TYPE_URL);
    }
}